package com.example.game_dafangdaxie.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.example.game_dafangdaxie.R;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TextView btn_single=findViewById(R.id.btn_single);
        TextView btn_multiple=findViewById(R.id.btn_multiple);
        TextView btn_help=findViewById(R.id.btn_help);
        TextView btn_about=findViewById(R.id.btn_about);
        myOnclick myOnclick=new myOnclick();
        btn_multiple.setOnClickListener(myOnclick);
        btn_single.setOnClickListener(myOnclick);
        btn_help.setOnClickListener(myOnclick);
        btn_about.setOnClickListener(myOnclick);

    }
    private class myOnclick implements View.OnClickListener {

        @Override
        public void onClick(View v) {
            Intent in=null;
            switch (v.getId()){
                case R.id.btn_single:
                    in=new Intent(MainActivity.this, GameActivity.class);
                    Bundle bundle=new Bundle();
                    bundle.putInt("code",1);
                    in.putExtra("viewCode",bundle);
                    startActivity(in);
                    break;
                case R.id.btn_multiple:
                    in=new Intent(MainActivity.this,GameActivity.class);
                    Bundle bundle1=new Bundle();
                    bundle1.putInt("code",2);
                    in.putExtra("viewCode",bundle1);
                    startActivity(in);
                    break;

                case R.id.btn_help:
                     in=new Intent(MainActivity.this, helpActivity.class);
                    startActivity(in);
                    break;
                case R.id.btn_about:
                     in=new Intent(MainActivity.this, aboutActivity.class);
                    startActivity(in);
                    break;
            }
        }

    }
}